package game;

import java.awt.Image;
import java.awt.Toolkit;
import java.net.URL;
import java.util.LinkedList;

public class LoadImage {
	
	//Variables
	private static LoadImage instance = null;
	public LinkedList<Image> textures;
	
	//Constructor
	private LoadImage() {}
	
	//Singleton
	public static LoadImage GetInstance()
	{
		if (instance == null)
		{
			instance = new LoadImage();
		}
		
		return instance;
	}
	
	//Initialize the texture list
	public void InitList()
	{
		Toolkit tk = Toolkit.getDefaultToolkit();
		textures = new LinkedList<Image>();
		textures.add(tk.getImage(getURL("/images/bg.jpg"))); // 0
		textures.add(tk.getImage(getURL("/images/cursor.png"))); // 1
		textures.add(tk.getImage(getURL("/images/player.png"))); // 2
		textures.add(tk.getImage(getURL("/images/opening.jpg"))); // 3
		textures.add(tk.getImage(getURL("/images/bullet.png"))); // 4
		textures.add(tk.getImage(getURL("/images/enemy.png"))); // 5
		textures.add(tk.getImage(getURL("/images/HudPlayer.png"))); // 6
		textures.add(tk.getImage(getURL("/images/HudArma.png"))); // 7
		textures.add(tk.getImage(getURL("/images/menu.png"))); // 8
		textures.add(tk.getImage(getURL("/images/bgMenu.jpg"))); // 9
		textures.add(tk.getImage(getURL("/images/bulletEnemie.png"))); // 10
		textures.add(tk.getImage(getURL("/images/instructions.png"))); // 11
		textures.add(tk.getImage(getURL("/images/credits.jpg"))); // 12
		textures.add(tk.getImage(getURL("/images/gameover.jpg"))); // 13
		textures.add(tk.getImage(getURL("/images/wavegames.png"))); // 14
		
	}
	
	public URL getURL(String filename)
	{
		URL url = null;
		try
		{
			url = this.getClass().getResource(filename);
		}
		catch (Exception e) { }
		return url;
	}
}
